// 导入请求根路径模块
import request from '@/utils/request'
/**
 * 房屋相关的请求模块
*/
// axios来请求获取本地JSON数据
import axios from 'axios'
// 获取城市列表数据的方法
export const getCityList = () => {
  return axios({
    method: 'GET',
    url: '/data/city.json'
  })
}
// 获取房屋查询条件的方法
export const getHousesList = (cityId) => {
  return request({
    method: 'GET',
    url: `/houses/condition?id=${cityId}`
  })
}
// 获取房屋信息的方法
export const getHousesInfo = (cityId, params) => {
  return request({
    method: 'GET',
    url: `/houses?cityId=${cityId}`,
    params
  })
}
// 获取房屋详情页数据的方法
export const getHousesDetails = (houseCode) => {
  return request({
    method: 'GET',
    url: `/houses/${houseCode}`
  })
}
// 获取发布房屋所需的条件
export const getHousingConditions = () => {
  return request({
    method: 'GET',
    url: '/houses/params'
  })
}
// 房屋图片上传方法
export const uploadMedia = (data) => {
  return request({
    method: 'POST',
    url: '/houses/image',
    data
  })
}
// getKeywords
export const getKeywords = (cityId, params) => {
  return request({
    method: 'GET',
    url: `/area/community?id=${cityId}`,
    params
  })
}
